{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "8408c95a-ad29-4f0f-8d69-039db31be768",
   "metadata": {},
   "outputs": [],
   "source": [
    "import polars  as pl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a32c8416-dd5b-4a29-bb61-86bfb0d43267",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pl.read_csv(\"stock_trades/202207-湘财.xls\",encoding=\"gb18030\",separator=\"\\t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a3d0aa23-445b-4e48-ab04-da3450cb8705",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(17, 16)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d2f7eba6-0371-43e3-b69c-e34050c052d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.height"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a83bb29d-6201-43d7-94f9-be8244d04629",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.width"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f6370e8c-f829-4d0a-b06a-9bab83b3974f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.is_empty()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a74ef922-eea2-468d-83bb-deee159ad37b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Schema([('发生日期', Int64),\n",
       "        ('证券代码', String),\n",
       "        ('证券名称', String),\n",
       "        ('买卖标志', String),\n",
       "        ('业务名称', String),\n",
       "        ('成交时间', String),\n",
       "        ('成交数量', String),\n",
       "        ('成交价格', Float64),\n",
       "        ('成交金额', Float64),\n",
       "        ('发生金额', Float64),\n",
       "        ('手续费', String),\n",
       "        ('印花税', String),\n",
       "        ('过户费', String),\n",
       "        ('其他费', String),\n",
       "        ('备注', String),\n",
       "        ('币种', String)])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.schema"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b36b7ca2-a35a-46dd-98d0-afaacdeb3331",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['发生日期',\n",
       " '证券代码',\n",
       " '证券名称',\n",
       " '买卖标志',\n",
       " '业务名称',\n",
       " '成交时间',\n",
       " '成交数量',\n",
       " '成交价格',\n",
       " '成交金额',\n",
       " '发生金额',\n",
       " '手续费',\n",
       " '印花税',\n",
       " '过户费',\n",
       " '其他费',\n",
       " '备注',\n",
       " '币种']"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1e0ccf96-4b13-4662-a595-a797eb7885e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Int64,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " Float64,\n",
       " Float64,\n",
       " Float64,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "65b84cdc-0b3f-47a5-9cdc-e3d97a0da0e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (1, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220721</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td><td>4884.0</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (1, 16)\n",
       "┌──────────┬──────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码 ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---      ┆ ---      ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ i64      ┆ str      ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞══════════╪══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 20220721 ┆ 600269   ┆ 赣粤高速 ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│          ┆          ┆          ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "└──────────┴──────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "cc198d1f-5c6c-4deb-807e-f402eda26223",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220721</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td><td>4884.0</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>1.675</td><td>58000.0</td><td>58018.63</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:18.63实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td><td>137184.67</td><td>&quot;21.98&quot;</td><td>&quot;137.35&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>12.6066</td><td>150019.0</td><td>-150044.49</td><td>&quot;24.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.49&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>20220711</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;09:39:27&quot;</td><td>&quot;580.00&quot;</td><td>1.675</td><td>58000.0</td><td>-58002.9</td><td>&quot;2.90&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券回购购回日:20220718预计利息:18.63参考占款…</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;601992&quot;</td><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:37:25&quot;</td><td>&quot;54000.00&quot;</td><td>2.59</td><td>139860.0</td><td>-139883.8</td><td>&quot;22.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.42&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;600894&quot;</td><td>&quot;广日股份&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:36:30&quot;</td><td>&quot;21400.00&quot;</td><td>6.54</td><td>139956.0</td><td>-139979.8</td><td>&quot;22.39&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.41&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;601077&quot;</td><td>&quot;渝农商行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:34:24&quot;</td><td>&quot;38300.00&quot;</td><td>3.65</td><td>139795.0</td><td>-139818.75</td><td>&quot;22.37&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220707</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;-7580.00&quot;</td><td>2.46</td><td>758000.0</td><td>758357.61</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:357.61实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 16)\n",
       "┌──────────┬───────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码  ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---      ┆ ---       ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ i64      ┆ str       ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞══════════╪═══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 20220721 ┆ 600269    ┆ 赣粤高速 ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "│ 20220718 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:18.63实际占款天数：7-8 ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 88880                           ┆        │\n",
       "│ 20220718 ┆ =\"002462\" ┆ 嘉事堂   ┆ 卖出     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券卖出                        ┆ 人民币 │\n",
       "│ 20220718 ┆ 600408    ┆ 安泰集团 ┆ 买入     ┆ … ┆ 1.51    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220718 ┆ 600648    ┆ 外高桥   ┆ 买入     ┆ … ┆ 1.49    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ …        ┆ …         ┆ …        ┆ …        ┆ … ┆ …       ┆ …       ┆ …                               ┆ …      │\n",
       "│ 20220711 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券回购购回日:20220718预计利息 ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ :18.63参考占款…                 ┆        │\n",
       "│ 20220711 ┆ 601992    ┆ 金隅集团 ┆ 买入     ┆ … ┆ 1.42    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220711 ┆ 600894    ┆ 广日股份 ┆ 买入     ┆ … ┆ 1.41    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220711 ┆ 601077    ┆ 渝农商行 ┆ 买入     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220707 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:357.61实际占款天数：7- ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 888880                          ┆        │\n",
       "└──────────┴───────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "75ad7be8-0c81-410f-bd77-b1f34bfca9de",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (4, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220721</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td><td>4884.0</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>1.675</td><td>58000.0</td><td>58018.63</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:18.63实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td><td>137184.67</td><td>&quot;21.98&quot;</td><td>&quot;137.35&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (4, 16)\n",
       "┌──────────┬───────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码  ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---      ┆ ---       ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ i64      ┆ str       ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞══════════╪═══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 20220721 ┆ 600269    ┆ 赣粤高速 ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "│ 20220718 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:18.63实际占款天数：7-8 ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 88880                           ┆        │\n",
       "│ 20220718 ┆ =\"002462\" ┆ 嘉事堂   ┆ 卖出     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券卖出                        ┆ 人民币 │\n",
       "│ 20220718 ┆ 600408    ┆ 安泰集团 ┆ 买入     ┆ … ┆ 1.51    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "└──────────┴───────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "a0e19667-4dd0-4b75-ab53-e00a8444fa3e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (2, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220718</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>12.6066</td><td>150019.0</td><td>-150044.49</td><td>&quot;24.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.49&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:43:38&quot;</td><td>&quot;40700.00&quot;</td><td>3.69</td><td>150183.0</td><td>-150208.53</td><td>&quot;24.03&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.50&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (2, 16)\n",
       "┌──────────┬──────────┬──────────┬──────────┬───┬────────┬─────────┬──────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码 ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费 ┆ 其他费  ┆ 备注     ┆ 币种   │\n",
       "│ ---      ┆ ---      ┆ ---      ┆ ---      ┆   ┆ ---    ┆ ---     ┆ ---      ┆ ---    │\n",
       "│ i64      ┆ str      ┆ str      ┆ str      ┆   ┆ str    ┆ str     ┆ str      ┆ str    │\n",
       "╞══════════╪══════════╪══════════╪══════════╪═══╪════════╪═════════╪══════════╪════════╡\n",
       "│ 20220718 ┆ 600648   ┆ 外高桥   ┆ 买入     ┆ … ┆ 1.49   ┆ =\"0.00\" ┆ 证券买入 ┆ 人民币 │\n",
       "│ 20220718 ┆ 600269   ┆ 赣粤高速 ┆ 买入     ┆ … ┆ 1.50   ┆ =\"0.00\" ┆ 证券买入 ┆ 人民币 │\n",
       "└──────────┴──────────┴──────────┴──────────┴───┴────────┴─────────┴──────────┴────────┘"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[4:6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "ab877b71-a591-4fe1-8af5-4c1964bdfe6c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17,)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>买卖标志</th></tr><tr><td>str</td></tr></thead><tbody><tr><td>&quot;卖出&quot;</td></tr><tr><td>&quot;卖出&quot;</td></tr><tr><td>&quot;卖出&quot;</td></tr><tr><td>&quot;买入&quot;</td></tr><tr><td>&quot;买入&quot;</td></tr><tr><td>&hellip;</td></tr><tr><td>&quot;卖出&quot;</td></tr><tr><td>&quot;买入&quot;</td></tr><tr><td>&quot;买入&quot;</td></tr><tr><td>&quot;买入&quot;</td></tr><tr><td>&quot;卖出&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17,)\n",
       "Series: '买卖标志' [str]\n",
       "[\n",
       "\t\"卖出\"\n",
       "\t\"卖出\"\n",
       "\t\"卖出\"\n",
       "\t\"买入\"\n",
       "\t\"买入\"\n",
       "\t…\n",
       "\t\"卖出\"\n",
       "\t\"买入\"\n",
       "\t\"买入\"\n",
       "\t\"买入\"\n",
       "\t\"卖出\"\n",
       "]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "447e6f0d-820b-4267-a002-a95c6a3299a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 3)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th><th>买卖标志</th><th>业务名称</th></tr><tr><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td></tr><tr><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td></tr><tr><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td></tr><tr><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td></tr><tr><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td></tr><tr><td>&quot;广日股份&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td></tr><tr><td>&quot;渝农商行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 3)\n",
       "┌──────────┬──────────┬──────────────┐\n",
       "│ 证券名称 ┆ 买卖标志 ┆ 业务名称     │\n",
       "│ ---      ┆ ---      ┆ ---          │\n",
       "│ str      ┆ str      ┆ str          │\n",
       "╞══════════╪══════════╪══════════════╡\n",
       "│ 赣粤高速 ┆ 卖出     ┆ 股息入账     │\n",
       "│ GC007    ┆ 卖出     ┆ 拆出质押购回 │\n",
       "│ 嘉事堂   ┆ 卖出     ┆ 证券卖出     │\n",
       "│ 安泰集团 ┆ 买入     ┆ 证券买入     │\n",
       "│ 外高桥   ┆ 买入     ┆ 证券买入     │\n",
       "│ …        ┆ …        ┆ …            │\n",
       "│ GC007    ┆ 卖出     ┆ 质押回购拆出 │\n",
       "│ 金隅集团 ┆ 买入     ┆ 证券买入     │\n",
       "│ 广日股份 ┆ 买入     ┆ 证券买入     │\n",
       "│ 渝农商行 ┆ 买入     ┆ 证券买入     │\n",
       "│ GC007    ┆ 卖出     ┆ 拆出质押购回 │\n",
       "└──────────┴──────────┴──────────────┘"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,2:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4fdf07dc-cf61-433f-b65f-3ad240c8afc0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>业务名称</th><th>发生金额</th></tr><tr><td>str</td><td>f64</td></tr></thead><tbody><tr><td>&quot;股息入账&quot;</td><td>4884.0</td></tr><tr><td>&quot;拆出质押购回&quot;</td><td>58018.63</td></tr><tr><td>&quot;证券卖出&quot;</td><td>137184.67</td></tr><tr><td>&quot;证券买入&quot;</td><td>-149955.5</td></tr><tr><td>&quot;证券买入&quot;</td><td>-150044.49</td></tr><tr><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;质押回购拆出&quot;</td><td>-58002.9</td></tr><tr><td>&quot;证券买入&quot;</td><td>-139883.8</td></tr><tr><td>&quot;证券买入&quot;</td><td>-139979.8</td></tr><tr><td>&quot;证券买入&quot;</td><td>-139818.75</td></tr><tr><td>&quot;拆出质押购回&quot;</td><td>758357.61</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 2)\n",
       "┌──────────────┬────────────┐\n",
       "│ 业务名称     ┆ 发生金额   │\n",
       "│ ---          ┆ ---        │\n",
       "│ str          ┆ f64        │\n",
       "╞══════════════╪════════════╡\n",
       "│ 股息入账     ┆ 4884.0     │\n",
       "│ 拆出质押购回 ┆ 58018.63   │\n",
       "│ 证券卖出     ┆ 137184.67  │\n",
       "│ 证券买入     ┆ -149955.5  │\n",
       "│ 证券买入     ┆ -150044.49 │\n",
       "│ …            ┆ …          │\n",
       "│ 质押回购拆出 ┆ -58002.9   │\n",
       "│ 证券买入     ┆ -139883.8  │\n",
       "│ 证券买入     ┆ -139979.8  │\n",
       "│ 证券买入     ┆ -139818.75 │\n",
       "│ 拆出质押购回 ┆ 758357.61  │\n",
       "└──────────────┴────────────┘"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,[\"业务名称\",\"发生金额\"]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0a3d2b26-e48a-4229-be5b-d5d1c6550c58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (3, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>业务名称</th><th>发生金额</th></tr><tr><td>str</td><td>f64</td></tr></thead><tbody><tr><td>&quot;证券买入&quot;</td><td>-149955.5</td></tr><tr><td>&quot;证券买入&quot;</td><td>-150208.53</td></tr><tr><td>&quot;证券卖出&quot;</td><td>138523.74</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (3, 2)\n",
       "┌──────────┬────────────┐\n",
       "│ 业务名称 ┆ 发生金额   │\n",
       "│ ---      ┆ ---        │\n",
       "│ str      ┆ f64        │\n",
       "╞══════════╪════════════╡\n",
       "│ 证券买入 ┆ -149955.5  │\n",
       "│ 证券买入 ┆ -150208.53 │\n",
       "│ 证券卖出 ┆ 138523.74  │\n",
       "└──────────┴────────────┘"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[[3,5,7],[\"业务名称\",\"发生金额\"]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "59a10e02-b26d-4098-92e3-dec155138c0e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows: 17\n",
      "Columns: 16\n",
      "$ 发生日期 <i64> 20220721, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718\n",
      "$ 证券代码 <str> '600269', '204007', '=\"002462\"', '600408', '600648', '600269', '600015', '601992', '600894', '601077'\n",
      "$ 证券名称 <str> '赣粤高速', 'GC007', '嘉事堂', '安泰集团', '外高桥', '赣粤高速', '华夏银行', '金隅集团', '广日股份', '渝农商行'\n",
      "$ 买卖标志 <str> '卖出', '卖出', '卖出', '买入', '买入', '买入', '买入', '卖出', '卖出', '卖出'\n",
      "$ 业务名称 <str> '股息入账', '拆出质押购回', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 成交时间 <str> '16:00:00', '19:03:27', '09:38:10', '09:44:52', '09:44:31', '09:43:38', '09:42:51', '09:39:28', '09:39:06', '09:38:30'\n",
      "$ 成交数量 <str> '=\"0.00\"', '-580.00', '-10400.00', '47000.00', '11900.00', '40700.00', '30000.00', '-54000.00', '-21400.00', '-38300.00'\n",
      "$ 成交价格 <f64> 3.6, 1.675, 13.2062, 3.19, 12.6066, 3.69, 5.07, 2.5683, 6.5419, 3.58\n",
      "$ 成交金额 <f64> 4884.0, 58000.0, 137344.0, 149930.0, 150019.0, 150183.0, 152100.0, 138686.0, 139996.0, 137114.0\n",
      "$ 发生金额 <f64> 4884.0, 58018.63, 137184.67, -149955.5, -150044.49, -150208.53, -152125.86, 138523.74, 139832.12, 136953.55\n",
      "$ 手续费  <str> '=\"0.00\"', '=\"0.00\"', '21.98', '23.99', '24.00', '24.03', '24.34', '22.19', '22.40', '21.94'\n",
      "$ 印花税  <str> '=\"0.00\"', '=\"0.00\"', '137.35', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '138.69', '140.02', '137.13'\n",
      "$ 过户费  <str> '=\"0.00\"', '=\"0.00\"', '1.38', '1.51', '1.49', '1.50', '1.52', '1.38', '1.46', '1.38'\n",
      "$ 其他费  <str> '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"'\n",
      "$ 备注   <str> '股息入账:赣粤高速600269; 权益股数:40700;', '融券购回:18.63实际占款天数：7-888880', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 币种   <str> '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币'\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df.glimpse()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "54dc0a48-4b16-48d3-b51c-aa2961dd1fb7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (5, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220721</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td><td>4884.0</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>1.675</td><td>58000.0</td><td>58018.63</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:18.63实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td><td>137184.67</td><td>&quot;21.98&quot;</td><td>&quot;137.35&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>12.6066</td><td>150019.0</td><td>-150044.49</td><td>&quot;24.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.49&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (5, 16)\n",
       "┌──────────┬───────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码  ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---      ┆ ---       ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ i64      ┆ str       ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞══════════╪═══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 20220721 ┆ 600269    ┆ 赣粤高速 ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "│ 20220718 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:18.63实际占款天数：7-8 ┆ 人民币 │\n",
       "│          ┆           ┆          ┆          ┆   ┆         ┆         ┆ 88880                           ┆        │\n",
       "│ 20220718 ┆ =\"002462\" ┆ 嘉事堂   ┆ 卖出     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券卖出                        ┆ 人民币 │\n",
       "│ 20220718 ┆ 600408    ┆ 安泰集团 ┆ 买入     ┆ … ┆ 1.51    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220718 ┆ 600648    ┆ 外高桥   ┆ 买入     ┆ … ┆ 1.49    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "└──────────┴───────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "968e9698-e69f-4dd1-8c95-8f40906d63bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (5, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220711</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;09:39:27&quot;</td><td>&quot;580.00&quot;</td><td>1.675</td><td>58000.0</td><td>-58002.9</td><td>&quot;2.90&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券回购购回日:20220718预计利息:18.63参考占款…</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;601992&quot;</td><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:37:25&quot;</td><td>&quot;54000.00&quot;</td><td>2.59</td><td>139860.0</td><td>-139883.8</td><td>&quot;22.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.42&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;600894&quot;</td><td>&quot;广日股份&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:36:30&quot;</td><td>&quot;21400.00&quot;</td><td>6.54</td><td>139956.0</td><td>-139979.8</td><td>&quot;22.39&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.41&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220711</td><td>&quot;601077&quot;</td><td>&quot;渝农商行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:34:24&quot;</td><td>&quot;38300.00&quot;</td><td>3.65</td><td>139795.0</td><td>-139818.75</td><td>&quot;22.37&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220707</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;-7580.00&quot;</td><td>2.46</td><td>758000.0</td><td>758357.61</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:357.61实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (5, 16)\n",
       "┌──────────┬──────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码 ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---      ┆ ---      ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ i64      ┆ str      ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞══════════╪══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 20220711 ┆ 204007   ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券回购购回日:20220718预计利息 ┆ 人民币 │\n",
       "│          ┆          ┆          ┆          ┆   ┆         ┆         ┆ :18.63参考占款…                 ┆        │\n",
       "│ 20220711 ┆ 601992   ┆ 金隅集团 ┆ 买入     ┆ … ┆ 1.42    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220711 ┆ 600894   ┆ 广日股份 ┆ 买入     ┆ … ┆ 1.41    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220711 ┆ 601077   ┆ 渝农商行 ┆ 买入     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 20220707 ┆ 204007   ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:357.61实际占款天数：7- ┆ 人民币 │\n",
       "│          ┆          ┆          ┆          ┆   ┆         ┆         ┆ 888880                          ┆        │\n",
       "└──────────┴──────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "a8acaf50-6e94-401a-ad3b-2bb65225bd5c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (1, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220711</td><td>&quot;=&quot;000900&quot;&quot;</td><td>&quot;现代投资&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:33:37&quot;</td><td>&quot;34400.00&quot;</td><td>4.05</td><td>139320.0</td><td>-139342.29</td><td>&quot;22.29&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.39&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (1, 16)\n",
       "┌──────────┬───────────┬──────────┬──────────┬───┬────────┬─────────┬──────────┬────────┐\n",
       "│ 发生日期 ┆ 证券代码  ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费 ┆ 其他费  ┆ 备注     ┆ 币种   │\n",
       "│ ---      ┆ ---       ┆ ---      ┆ ---      ┆   ┆ ---    ┆ ---     ┆ ---      ┆ ---    │\n",
       "│ i64      ┆ str       ┆ str      ┆ str      ┆   ┆ str    ┆ str     ┆ str      ┆ str    │\n",
       "╞══════════╪═══════════╪══════════╪══════════╪═══╪════════╪═════════╪══════════╪════════╡\n",
       "│ 20220711 ┆ =\"000900\" ┆ 现代投资 ┆ 买入     ┆ … ┆ 1.39   ┆ =\"0.00\" ┆ 证券买入 ┆ 人民币 │\n",
       "└──────────┴───────────┴──────────┴──────────┴───┴────────┴─────────┴──────────┴────────┘"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sample()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "3f659d0b-38ed-402e-be9d-a9ae3f1575fa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (9, 17)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>statistic</th><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>str</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;count&quot;</td><td>17.0</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>17.0</td><td>17.0</td><td>17.0</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td></tr><tr><td>&quot;null_count&quot;</td><td>0.0</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td></tr><tr><td>&quot;mean&quot;</td><td>2.0221e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>5.306059</td><td>160805.352941</td><td>815.642353</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;std&quot;</td><td>4.160387</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>3.974618</td><td>159439.770376</td><td>230047.143813</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;min&quot;</td><td>2.0220707e7</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;买入&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;09:33:37&quot;</td><td>&quot;-10400.00&quot;</td><td>1.675</td><td>4884.0</td><td>-152125.86</td><td>&quot;2.90&quot;</td><td>&quot;137.13&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>&quot;25%&quot;</td><td>2.0220711e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>2.59</td><td>137344.0</td><td>-140526.48</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;50%&quot;</td><td>2.0220718e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>3.65</td><td>139860.0</td><td>-139342.29</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;75%&quot;</td><td>2.0220718e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>6.54</td><td>149930.0</td><td>136953.55</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;max&quot;</td><td>2.0220721e7</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;金隅集团&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>13.51</td><td>758000.0</td><td>758357.61</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (9, 17)\n",
       "┌────────────┬─────────────┬───────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ statistic  ┆ 发生日期    ┆ 证券代码  ┆ 证券名称 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---        ┆ ---         ┆ ---       ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ str        ┆ f64         ┆ str       ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞════════════╪═════════════╪═══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ count      ┆ 17.0        ┆ 17        ┆ 17       ┆ … ┆ 17      ┆ 17      ┆ 17                              ┆ 17     │\n",
       "│ null_count ┆ 0.0         ┆ 0         ┆ 0        ┆ … ┆ 0       ┆ 0       ┆ 0                               ┆ 0      │\n",
       "│ mean       ┆ 2.0221e7    ┆ null      ┆ null     ┆ … ┆ null    ┆ null    ┆ null                            ┆ null   │\n",
       "│ std        ┆ 4.160387    ┆ null      ┆ null     ┆ … ┆ null    ┆ null    ┆ null                            ┆ null   │\n",
       "│ min        ┆ 2.0220707e7 ┆ 204007    ┆ GC007    ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│            ┆             ┆           ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "│ 25%        ┆ 2.0220711e7 ┆ null      ┆ null     ┆ … ┆ null    ┆ null    ┆ null                            ┆ null   │\n",
       "│ 50%        ┆ 2.0220718e7 ┆ null      ┆ null     ┆ … ┆ null    ┆ null    ┆ null                            ┆ null   │\n",
       "│ 75%        ┆ 2.0220718e7 ┆ null      ┆ null     ┆ … ┆ null    ┆ null    ┆ null                            ┆ null   │\n",
       "│ max        ┆ 2.0220721e7 ┆ =\"002462\" ┆ 金隅集团 ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 证券卖出                        ┆ 人民币 │\n",
       "└────────────┴─────────────┴───────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "146dae51-2f5c-4731-a7cb-de1f9a902496",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (1, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td><td>u32</td></tr></thead><tbody><tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (1, 16)\n",
       "┌──────────┬──────────┬──────────┬──────────┬───┬────────┬────────┬──────┬──────┐\n",
       "│ 发生日期 ┆ 证券代码 ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注 ┆ 币种 │\n",
       "│ ---      ┆ ---      ┆ ---      ┆ ---      ┆   ┆ ---    ┆ ---    ┆ ---  ┆ ---  │\n",
       "│ u32      ┆ u32      ┆ u32      ┆ u32      ┆   ┆ u32    ┆ u32    ┆ u32  ┆ u32  │\n",
       "╞══════════╪══════════╪══════════╪══════════╪═══╪════════╪════════╪══════╪══════╡\n",
       "│ 0        ┆ 0        ┆ 0        ┆ 0        ┆ … ┆ 0      ┆ 0      ┆ 0    ┆ 0    │\n",
       "└──────────┴──────────┴──────────┴──────────┴───┴────────┴────────┴──────┴──────┘"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.null_count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "2a137c1d-5ff6-4b9f-b8da-57bb344ffc1f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发生日期</th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>买卖标志</th>\n",
       "      <th>业务名称</th>\n",
       "      <th>成交时间</th>\n",
       "      <th>成交数量</th>\n",
       "      <th>成交价格</th>\n",
       "      <th>成交金额</th>\n",
       "      <th>发生金额</th>\n",
       "      <th>手续费</th>\n",
       "      <th>印花税</th>\n",
       "      <th>过户费</th>\n",
       "      <th>其他费</th>\n",
       "      <th>备注</th>\n",
       "      <th>币种</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20220721</td>\n",
       "      <td>600269</td>\n",
       "      <td>赣粤高速</td>\n",
       "      <td>卖出</td>\n",
       "      <td>股息入账</td>\n",
       "      <td>16:00:00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>3.6000</td>\n",
       "      <td>4884.0</td>\n",
       "      <td>4884.00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>股息入账:赣粤高速600269; 权益股数:40700;</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20220718</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>拆出质押购回</td>\n",
       "      <td>19:03:27</td>\n",
       "      <td>-580.00</td>\n",
       "      <td>1.6750</td>\n",
       "      <td>58000.0</td>\n",
       "      <td>58018.63</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券购回:18.63实际占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20220718</td>\n",
       "      <td>=\"002462\"</td>\n",
       "      <td>嘉事堂</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:38:10</td>\n",
       "      <td>-10400.00</td>\n",
       "      <td>13.2062</td>\n",
       "      <td>137344.0</td>\n",
       "      <td>137184.67</td>\n",
       "      <td>21.98</td>\n",
       "      <td>137.35</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600408</td>\n",
       "      <td>安泰集团</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:44:52</td>\n",
       "      <td>47000.00</td>\n",
       "      <td>3.1900</td>\n",
       "      <td>149930.0</td>\n",
       "      <td>-149955.50</td>\n",
       "      <td>23.99</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.51</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600648</td>\n",
       "      <td>外高桥</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:44:31</td>\n",
       "      <td>11900.00</td>\n",
       "      <td>12.6066</td>\n",
       "      <td>150019.0</td>\n",
       "      <td>-150044.49</td>\n",
       "      <td>24.00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.49</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600269</td>\n",
       "      <td>赣粤高速</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:43:38</td>\n",
       "      <td>40700.00</td>\n",
       "      <td>3.6900</td>\n",
       "      <td>150183.0</td>\n",
       "      <td>-150208.53</td>\n",
       "      <td>24.03</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.50</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600015</td>\n",
       "      <td>华夏银行</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:42:51</td>\n",
       "      <td>30000.00</td>\n",
       "      <td>5.0700</td>\n",
       "      <td>152100.0</td>\n",
       "      <td>-152125.86</td>\n",
       "      <td>24.34</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.52</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>20220718</td>\n",
       "      <td>601992</td>\n",
       "      <td>金隅集团</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:39:28</td>\n",
       "      <td>-54000.00</td>\n",
       "      <td>2.5683</td>\n",
       "      <td>138686.0</td>\n",
       "      <td>138523.74</td>\n",
       "      <td>22.19</td>\n",
       "      <td>138.69</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600894</td>\n",
       "      <td>广日股份</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:39:06</td>\n",
       "      <td>-21400.00</td>\n",
       "      <td>6.5419</td>\n",
       "      <td>139996.0</td>\n",
       "      <td>139832.12</td>\n",
       "      <td>22.40</td>\n",
       "      <td>140.02</td>\n",
       "      <td>1.46</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>20220718</td>\n",
       "      <td>601077</td>\n",
       "      <td>渝农商行</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:38:30</td>\n",
       "      <td>-38300.00</td>\n",
       "      <td>3.5800</td>\n",
       "      <td>137114.0</td>\n",
       "      <td>136953.55</td>\n",
       "      <td>21.94</td>\n",
       "      <td>137.13</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>20220711</td>\n",
       "      <td>=\"002462\"</td>\n",
       "      <td>嘉事堂</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:38:16</td>\n",
       "      <td>10400.00</td>\n",
       "      <td>13.5100</td>\n",
       "      <td>140504.0</td>\n",
       "      <td>-140526.48</td>\n",
       "      <td>22.48</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.41</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>20220711</td>\n",
       "      <td>=\"000900\"</td>\n",
       "      <td>现代投资</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:33:37</td>\n",
       "      <td>34400.00</td>\n",
       "      <td>4.0500</td>\n",
       "      <td>139320.0</td>\n",
       "      <td>-139342.29</td>\n",
       "      <td>22.29</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.39</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>20220711</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>质押回购拆出</td>\n",
       "      <td>09:39:27</td>\n",
       "      <td>580.00</td>\n",
       "      <td>1.6750</td>\n",
       "      <td>58000.0</td>\n",
       "      <td>-58002.90</td>\n",
       "      <td>2.90</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券回购购回日:20220718预计利息:18.63参考占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>20220711</td>\n",
       "      <td>601992</td>\n",
       "      <td>金隅集团</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:37:25</td>\n",
       "      <td>54000.00</td>\n",
       "      <td>2.5900</td>\n",
       "      <td>139860.0</td>\n",
       "      <td>-139883.80</td>\n",
       "      <td>22.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.42</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>20220711</td>\n",
       "      <td>600894</td>\n",
       "      <td>广日股份</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:36:30</td>\n",
       "      <td>21400.00</td>\n",
       "      <td>6.5400</td>\n",
       "      <td>139956.0</td>\n",
       "      <td>-139979.80</td>\n",
       "      <td>22.39</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.41</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>20220711</td>\n",
       "      <td>601077</td>\n",
       "      <td>渝农商行</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:34:24</td>\n",
       "      <td>38300.00</td>\n",
       "      <td>3.6500</td>\n",
       "      <td>139795.0</td>\n",
       "      <td>-139818.75</td>\n",
       "      <td>22.37</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>20220707</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>拆出质押购回</td>\n",
       "      <td>19:17:51</td>\n",
       "      <td>-7580.00</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>758000.0</td>\n",
       "      <td>758357.61</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券购回:357.61实际占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        发生日期       证券代码   证券名称 买卖标志    业务名称      成交时间       成交数量     成交价格  \\\n",
       "0   20220721     600269   赣粤高速   卖出    股息入账  16:00:00    =\"0.00\"   3.6000   \n",
       "1   20220718     204007  GC007   卖出  拆出质押购回  19:03:27    -580.00   1.6750   \n",
       "2   20220718  =\"002462\"    嘉事堂   卖出    证券卖出  09:38:10  -10400.00  13.2062   \n",
       "3   20220718     600408   安泰集团   买入    证券买入  09:44:52   47000.00   3.1900   \n",
       "4   20220718     600648    外高桥   买入    证券买入  09:44:31   11900.00  12.6066   \n",
       "5   20220718     600269   赣粤高速   买入    证券买入  09:43:38   40700.00   3.6900   \n",
       "6   20220718     600015   华夏银行   买入    证券买入  09:42:51   30000.00   5.0700   \n",
       "7   20220718     601992   金隅集团   卖出    证券卖出  09:39:28  -54000.00   2.5683   \n",
       "8   20220718     600894   广日股份   卖出    证券卖出  09:39:06  -21400.00   6.5419   \n",
       "9   20220718     601077   渝农商行   卖出    证券卖出  09:38:30  -38300.00   3.5800   \n",
       "10  20220711  =\"002462\"    嘉事堂   买入    证券买入  09:38:16   10400.00  13.5100   \n",
       "11  20220711  =\"000900\"   现代投资   买入    证券买入  09:33:37   34400.00   4.0500   \n",
       "12  20220711     204007  GC007   卖出  质押回购拆出  09:39:27     580.00   1.6750   \n",
       "13  20220711     601992   金隅集团   买入    证券买入  09:37:25   54000.00   2.5900   \n",
       "14  20220711     600894   广日股份   买入    证券买入  09:36:30   21400.00   6.5400   \n",
       "15  20220711     601077   渝农商行   买入    证券买入  09:34:24   38300.00   3.6500   \n",
       "16  20220707     204007  GC007   卖出  拆出质押购回  19:17:51   -7580.00   2.4600   \n",
       "\n",
       "        成交金额       发生金额      手续费      印花税      过户费      其他费  \\\n",
       "0     4884.0    4884.00  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "1    58000.0   58018.63  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "2   137344.0  137184.67    21.98   137.35     1.38  =\"0.00\"   \n",
       "3   149930.0 -149955.50    23.99  =\"0.00\"     1.51  =\"0.00\"   \n",
       "4   150019.0 -150044.49    24.00  =\"0.00\"     1.49  =\"0.00\"   \n",
       "5   150183.0 -150208.53    24.03  =\"0.00\"     1.50  =\"0.00\"   \n",
       "6   152100.0 -152125.86    24.34  =\"0.00\"     1.52  =\"0.00\"   \n",
       "7   138686.0  138523.74    22.19   138.69     1.38  =\"0.00\"   \n",
       "8   139996.0  139832.12    22.40   140.02     1.46  =\"0.00\"   \n",
       "9   137114.0  136953.55    21.94   137.13     1.38  =\"0.00\"   \n",
       "10  140504.0 -140526.48    22.48  =\"0.00\"     1.41  =\"0.00\"   \n",
       "11  139320.0 -139342.29    22.29  =\"0.00\"     1.39  =\"0.00\"   \n",
       "12   58000.0  -58002.90     2.90  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "13  139860.0 -139883.80    22.38  =\"0.00\"     1.42  =\"0.00\"   \n",
       "14  139956.0 -139979.80    22.39  =\"0.00\"     1.41  =\"0.00\"   \n",
       "15  139795.0 -139818.75    22.37  =\"0.00\"     1.38  =\"0.00\"   \n",
       "16  758000.0  758357.61  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "\n",
       "                                           备注   币种  \n",
       "0                股息入账:赣粤高速600269; 权益股数:40700;  人民币  \n",
       "1                   融券购回:18.63实际占款天数：7-888880  人民币  \n",
       "2                                        证券卖出  人民币  \n",
       "3                                        证券买入  人民币  \n",
       "4                                        证券买入  人民币  \n",
       "5                                        证券买入  人民币  \n",
       "6                                        证券买入  人民币  \n",
       "7                                        证券卖出  人民币  \n",
       "8                                        证券卖出  人民币  \n",
       "9                                        证券卖出  人民币  \n",
       "10                                       证券买入  人民币  \n",
       "11                                       证券买入  人民币  \n",
       "12  融券回购购回日:20220718预计利息:18.63参考占款天数：7-888880  人民币  \n",
       "13                                       证券买入  人民币  \n",
       "14                                       证券买入  人民币  \n",
       "15                                       证券买入  人民币  \n",
       "16                 融券购回:357.61实际占款天数：7-888880  人民币  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "58a357d5-c2ff-4597-8c4f-2eb80ba8d333",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pyarrow.Table\n",
       "发生日期: int64\n",
       "证券代码: large_string\n",
       "证券名称: large_string\n",
       "买卖标志: large_string\n",
       "业务名称: large_string\n",
       "成交时间: large_string\n",
       "成交数量: large_string\n",
       "成交价格: double\n",
       "成交金额: double\n",
       "发生金额: double\n",
       "手续费: large_string\n",
       "印花税: large_string\n",
       "过户费: large_string\n",
       "其他费: large_string\n",
       "备注: large_string\n",
       "币种: large_string\n",
       "----\n",
       "发生日期: [[20220721,20220718,20220718,20220718,20220718,...,20220711,20220711,20220711,20220711,20220707]]\n",
       "证券代码: [[\"600269\",\"204007\",\"=\"002462\"\",\"600408\",\"600648\",...,\"204007\",\"601992\",\"600894\",\"601077\",\"204007\"]]\n",
       "证券名称: [[\"赣粤高速\",\"GC007\",\"嘉事堂\",\"安泰集团\",\"外高桥\",...,\"GC007\",\"金隅集团\",\"广日股份\",\"渝农商行\",\"GC007\"]]\n",
       "买卖标志: [[\"卖出\",\"卖出\",\"卖出\",\"买入\",\"买入\",...,\"卖出\",\"买入\",\"买入\",\"买入\",\"卖出\"]]\n",
       "业务名称: [[\"股息入账\",\"拆出质押购回\",\"证券卖出\",\"证券买入\",\"证券买入\",...,\"质押回购拆出\",\"证券买入\",\"证券买入\",\"证券买入\",\"拆出质押购回\"]]\n",
       "成交时间: [[\"16:00:00\",\"19:03:27\",\"09:38:10\",\"09:44:52\",\"09:44:31\",...,\"09:39:27\",\"09:37:25\",\"09:36:30\",\"09:34:24\",\"19:17:51\"]]\n",
       "成交数量: [[\"=\"0.00\"\",\"-580.00\",\"-10400.00\",\"47000.00\",\"11900.00\",...,\"580.00\",\"54000.00\",\"21400.00\",\"38300.00\",\"-7580.00\"]]\n",
       "成交价格: [[3.6,1.675,13.2062,3.19,12.6066,...,1.675,2.59,6.54,3.65,2.46]]\n",
       "成交金额: [[4884,58000,137344,149930,150019,...,58000,139860,139956,139795,758000]]\n",
       "发生金额: [[4884,58018.63,137184.67,-149955.5,-150044.49,...,-58002.9,-139883.8,-139979.8,-139818.75,758357.61]]\n",
       "..."
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_arrow()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "f250f039-eedd-4d63-8fb8-90bda7f0b7ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=df.to_series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "46e4cb82-b85d-4b3d-a782-0d0bea436558",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'发生日期'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "67f441f4-60bc-40a2-9736-f6a859e52673",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3fa6203b-e182-4d32-925c-70b1234cbbf2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(17,)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "65dcbe90-1ed2-4cae-870d-dc4a5eaae59e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.len()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "49521e30-c7b4-4339-8abf-5fc68924cfdf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (3,)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th></tr><tr><td>i64</td></tr></thead><tbody><tr><td>20220718</td></tr><tr><td>20220718</td></tr><tr><td>20220718</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (3,)\n",
       "Series: '发生日期' [i64]\n",
       "[\n",
       "\t20220718\n",
       "\t20220718\n",
       "\t20220718\n",
       "]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s[2,6,9]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "1adbcb5c-55d9-4223-a434-de63708c4c5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (10,)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th></tr><tr><td>str</td></tr></thead><tbody><tr><td>&quot;GC007&quot;</td></tr><tr><td>&quot;外高桥&quot;</td></tr><tr><td>&quot;渝农商行&quot;</td></tr><tr><td>&quot;嘉事堂&quot;</td></tr><tr><td>&quot;华夏银行&quot;</td></tr><tr><td>&quot;金隅集团&quot;</td></tr><tr><td>&quot;赣粤高速&quot;</td></tr><tr><td>&quot;安泰集团&quot;</td></tr><tr><td>&quot;广日股份&quot;</td></tr><tr><td>&quot;现代投资&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (10,)\n",
       "Series: '证券名称' [str]\n",
       "[\n",
       "\t\"GC007\"\n",
       "\t\"外高桥\"\n",
       "\t\"渝农商行\"\n",
       "\t\"嘉事堂\"\n",
       "\t\"华夏银行\"\n",
       "\t\"金隅集团\"\n",
       "\t\"赣粤高速\"\n",
       "\t\"安泰集团\"\n",
       "\t\"广日股份\"\n",
       "\t\"现代投资\"\n",
       "]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_series(2).unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "a7c45ad3-9c91-423e-8d59-45d93547df74",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (10, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th><th>count</th></tr><tr><td>str</td><td>u32</td></tr></thead><tbody><tr><td>&quot;华夏银行&quot;</td><td>1</td></tr><tr><td>&quot;外高桥&quot;</td><td>1</td></tr><tr><td>&quot;金隅集团&quot;</td><td>2</td></tr><tr><td>&quot;现代投资&quot;</td><td>1</td></tr><tr><td>&quot;赣粤高速&quot;</td><td>2</td></tr><tr><td>&quot;安泰集团&quot;</td><td>1</td></tr><tr><td>&quot;GC007&quot;</td><td>3</td></tr><tr><td>&quot;渝农商行&quot;</td><td>2</td></tr><tr><td>&quot;嘉事堂&quot;</td><td>2</td></tr><tr><td>&quot;广日股份&quot;</td><td>2</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (10, 2)\n",
       "┌──────────┬───────┐\n",
       "│ 证券名称 ┆ count │\n",
       "│ ---      ┆ ---   │\n",
       "│ str      ┆ u32   │\n",
       "╞══════════╪═══════╡\n",
       "│ 华夏银行 ┆ 1     │\n",
       "│ 外高桥   ┆ 1     │\n",
       "│ 金隅集团 ┆ 2     │\n",
       "│ 现代投资 ┆ 1     │\n",
       "│ 赣粤高速 ┆ 2     │\n",
       "│ 安泰集团 ┆ 1     │\n",
       "│ GC007    ┆ 3     │\n",
       "│ 渝农商行 ┆ 2     │\n",
       "│ 嘉事堂   ┆ 2     │\n",
       "│ 广日股份 ┆ 2     │\n",
       "└──────────┴───────┘"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_series(2).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "e5d5c8d5-6d95-4c42-963a-770ad31a87df",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (9, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>statistic</th><th>value</th></tr><tr><td>str</td><td>f64</td></tr></thead><tbody><tr><td>&quot;count&quot;</td><td>17.0</td></tr><tr><td>&quot;null_count&quot;</td><td>0.0</td></tr><tr><td>&quot;mean&quot;</td><td>815.642353</td></tr><tr><td>&quot;std&quot;</td><td>230047.143813</td></tr><tr><td>&quot;min&quot;</td><td>-152125.86</td></tr><tr><td>&quot;25%&quot;</td><td>-140526.48</td></tr><tr><td>&quot;50%&quot;</td><td>-139342.29</td></tr><tr><td>&quot;75%&quot;</td><td>136953.55</td></tr><tr><td>&quot;max&quot;</td><td>758357.61</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (9, 2)\n",
       "┌────────────┬───────────────┐\n",
       "│ statistic  ┆ value         │\n",
       "│ ---        ┆ ---           │\n",
       "│ str        ┆ f64           │\n",
       "╞════════════╪═══════════════╡\n",
       "│ count      ┆ 17.0          │\n",
       "│ null_count ┆ 0.0           │\n",
       "│ mean       ┆ 815.642353    │\n",
       "│ std        ┆ 230047.143813 │\n",
       "│ min        ┆ -152125.86    │\n",
       "│ 25%        ┆ -140526.48    │\n",
       "│ 50%        ┆ -139342.29    │\n",
       "│ 75%        ┆ 136953.55     │\n",
       "│ max        ┆ 758357.61     │\n",
       "└────────────┴───────────────┘"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,\"发生金额\"].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "5b5e60b9-9d21-4736-b687-9f7e745ffa89",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[4884.0,\n",
       " 58018.63,\n",
       " 137184.67,\n",
       " -149955.5,\n",
       " -150044.49,\n",
       " -150208.53,\n",
       " -152125.86,\n",
       " 138523.74,\n",
       " 139832.12,\n",
       " 136953.55,\n",
       " -140526.48,\n",
       " -139342.29,\n",
       " -58002.9,\n",
       " -139883.8,\n",
       " -139979.8,\n",
       " -139818.75,\n",
       " 758357.61]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,\"发生金额\"].to_list()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "932bd818-4f98-4acb-bcae-5079eff13efa",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pl.read_csv(\"stock_trades/202207-湘财.xls\",encoding=\"gb18030\",separator=\"\\t\",infer_schema=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "0ab92287-249c-4892-8e80-31e920bfd59b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=df.with_columns(\n",
    "    pl.col(\"发生日期\").str.to_date(\"%Y%m%d\"),\n",
    " )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "41b69b8e-c938-4e13-944a-bd431afa29ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>date</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>2022-07-21</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;3.6000&quot;</td><td>&quot;4884.00&quot;</td><td>&quot;4884.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>&quot;1.6750&quot;</td><td>&quot;58000.00&quot;</td><td>&quot;58018.63&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:18.63实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>&quot;13.2062&quot;</td><td>&quot;137344.00&quot;</td><td>&quot;137184.67&quot;</td><td>&quot;21.98&quot;</td><td>&quot;137.35&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>&quot;3.1900&quot;</td><td>&quot;149930.00&quot;</td><td>&quot;-149955.50&quot;</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>&quot;12.6066&quot;</td><td>&quot;150019.00&quot;</td><td>&quot;-150044.49&quot;</td><td>&quot;24.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.49&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>2022-07-11</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;09:39:27&quot;</td><td>&quot;580.00&quot;</td><td>&quot;1.6750&quot;</td><td>&quot;58000.00&quot;</td><td>&quot;-58002.90&quot;</td><td>&quot;2.90&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券回购购回日:20220718预计利息:18.63参考占款…</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-11</td><td>&quot;601992&quot;</td><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:37:25&quot;</td><td>&quot;54000.00&quot;</td><td>&quot;2.5900&quot;</td><td>&quot;139860.00&quot;</td><td>&quot;-139883.80&quot;</td><td>&quot;22.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.42&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-11</td><td>&quot;600894&quot;</td><td>&quot;广日股份&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:36:30&quot;</td><td>&quot;21400.00&quot;</td><td>&quot;6.5400&quot;</td><td>&quot;139956.00&quot;</td><td>&quot;-139979.80&quot;</td><td>&quot;22.39&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.41&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-11</td><td>&quot;601077&quot;</td><td>&quot;渝农商行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:34:24&quot;</td><td>&quot;38300.00&quot;</td><td>&quot;3.6500&quot;</td><td>&quot;139795.00&quot;</td><td>&quot;-139818.75&quot;</td><td>&quot;22.37&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2022-07-07</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;-7580.00&quot;</td><td>&quot;2.4600&quot;</td><td>&quot;758000.00&quot;</td><td>&quot;758357.61&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:357.61实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 16)\n",
       "┌────────────┬───────────┬──────────┬──────────┬───┬─────────┬─────────┬─────────────────────────────────┬────────┐\n",
       "│ 发生日期   ┆ 证券代码  ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 过户费  ┆ 其他费  ┆ 备注                            ┆ 币种   │\n",
       "│ ---        ┆ ---       ┆ ---      ┆ ---      ┆   ┆ ---     ┆ ---     ┆ ---                             ┆ ---    │\n",
       "│ date       ┆ str       ┆ str      ┆ str      ┆   ┆ str     ┆ str     ┆ str                             ┆ str    │\n",
       "╞════════════╪═══════════╪══════════╪══════════╪═══╪═════════╪═════════╪═════════════════════════════════╪════════╡\n",
       "│ 2022-07-21 ┆ 600269    ┆ 赣粤高速 ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 股息入账:赣粤高速600269;        ┆ 人民币 │\n",
       "│            ┆           ┆          ┆          ┆   ┆         ┆         ┆ 权益股数:40700;                 ┆        │\n",
       "│ 2022-07-18 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:18.63实际占款天数：7-8 ┆ 人民币 │\n",
       "│            ┆           ┆          ┆          ┆   ┆         ┆         ┆ 88880                           ┆        │\n",
       "│ 2022-07-18 ┆ =\"002462\" ┆ 嘉事堂   ┆ 卖出     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券卖出                        ┆ 人民币 │\n",
       "│ 2022-07-18 ┆ 600408    ┆ 安泰集团 ┆ 买入     ┆ … ┆ 1.51    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 2022-07-18 ┆ 600648    ┆ 外高桥   ┆ 买入     ┆ … ┆ 1.49    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ …          ┆ …         ┆ …        ┆ …        ┆ … ┆ …       ┆ …       ┆ …                               ┆ …      │\n",
       "│ 2022-07-11 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券回购购回日:20220718预计利息 ┆ 人民币 │\n",
       "│            ┆           ┆          ┆          ┆   ┆         ┆         ┆ :18.63参考占款…                 ┆        │\n",
       "│ 2022-07-11 ┆ 601992    ┆ 金隅集团 ┆ 买入     ┆ … ┆ 1.42    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 2022-07-11 ┆ 600894    ┆ 广日股份 ┆ 买入     ┆ … ┆ 1.41    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 2022-07-11 ┆ 601077    ┆ 渝农商行 ┆ 买入     ┆ … ┆ 1.38    ┆ =\"0.00\" ┆ 证券买入                        ┆ 人民币 │\n",
       "│ 2022-07-07 ┆ 204007    ┆ GC007    ┆ 卖出     ┆ … ┆ =\"0.00\" ┆ =\"0.00\" ┆ 融券购回:357.61实际占款天数：7- ┆ 人民币 │\n",
       "│            ┆           ┆          ┆          ┆   ┆         ┆         ┆ 888880                          ┆        │\n",
       "└────────────┴───────────┴──────────┴──────────┴───┴─────────┴─────────┴─────────────────────────────────┴────────┘"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "0636a96c-9f33-45fe-bbef-2f563785dfd8",
   "metadata": {},
   "outputs": [],
   "source": [
    "def read_df_湘财 (f:str |Path)-> pl.DataFrame:\n",
    "    df=pl.read_csv(\n",
    "       f,\n",
    "       encoding=\"gb18030\",\n",
    "       separator=\"\\t\",\n",
    "       infer_schema=False\n",
    "    )\n",
    "    df=df.with_columns(\n",
    "    pl.selectors.all().str.strip_prefix(\"=\").str.strip_chars('\"'),\n",
    "    ).with_columns(\n",
    "       pl.col(\"发生日期\").str.to_date(\"%Y%m%d\"),\n",
    "       pl.col(\"证券代码\").str.strip_prefix(\"=\").str.strip_chars('\"'),\n",
    "       pl.col(\"成交时间\").str.to_time(),\n",
    "       pl.col(\"成交数量\",\"成交价格\",\"成交金额\",\"发生金额\",\"手续费\",\"印花税\",\"过户费\",\"其他费\").cast(pl.Float64),                       \n",
    "    )\n",
    "    df=df.filter(\n",
    "    pl.col(\"业务名称\").is_in([\"证券买入\", \"证券卖出\"]),\n",
    "    )\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "34521c6d-1fbc-465a-bcf4-47dfd6be6a91",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "3ca576a0-b77e-48f1-b2c9-8a1c8809e623",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[WindowsPath('stock_trades/202207-湘财.xls'),\n",
       " WindowsPath('stock_trades/202208-湘财.xls'),\n",
       " WindowsPath('stock_trades/202209-湘财.xls'),\n",
       " WindowsPath('stock_trades/202210-湘财.xls'),\n",
       " WindowsPath('stock_trades/202211-湘财.xls'),\n",
       " WindowsPath('stock_trades/202212-湘财.xls'),\n",
       " WindowsPath('stock_trades/202301-湘财.xls'),\n",
       " WindowsPath('stock_trades/202302-湘财.xls'),\n",
       " WindowsPath('stock_trades/202303-湘财.xls'),\n",
       " WindowsPath('stock_trades/202304-湘财.xls'),\n",
       " WindowsPath('stock_trades/202305-湘财.xls'),\n",
       " WindowsPath('stock_trades/202306-湘财.xls'),\n",
       " WindowsPath('stock_trades/202309-湘财.xls')]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(Path(\"stock_trades/\").glob(\"*-湘财.xls\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "c5925c9b-3b2f-4f4a-a05c-f0dd12dad10f",
   "metadata": {},
   "outputs": [],
   "source": [
    "df =[read_df_湘财(f) for f in (Path(\"stock_trades/\").glob(\"*-湘财.xls\"))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "02c5418d-2704-47f7-8e81-a4024d9f6b62",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "eb738224-ec3b-435e-9c03-556b59520ae8",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=pl.concat(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "0b845174-cee2-4087-ac22-dc6df15ce435",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=d1.with_columns(券商=pl.lit(\"湘财\"),)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "4836aae1-6eb3-481c-9d10-a3ebaeed94bc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (257, 17)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th><th>券商</th></tr><tr><td>date</td><td>str</td><td>str</td><td>str</td><td>str</td><td>time</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>2022-07-18</td><td>&quot;002462&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>09:38:10</td><td>-10400.0</td><td>13.2062</td><td>137344.0</td><td>137184.67</td><td>21.98</td><td>137.35</td><td>1.38</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>09:44:52</td><td>47000.0</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>23.99</td><td>0.0</td><td>1.51</td><td>0.0</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>09:44:31</td><td>11900.0</td><td>12.6066</td><td>150019.0</td><td>-150044.49</td><td>24.0</td><td>0.0</td><td>1.49</td><td>0.0</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>09:43:38</td><td>40700.0</td><td>3.69</td><td>150183.0</td><td>-150208.53</td><td>24.03</td><td>0.0</td><td>1.5</td><td>0.0</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2022-07-18</td><td>&quot;600015&quot;</td><td>&quot;华夏银行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>09:42:51</td><td>30000.0</td><td>5.07</td><td>152100.0</td><td>-152125.86</td><td>24.34</td><td>0.0</td><td>1.52</td><td>0.0</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>2023-06-19</td><td>&quot;603967&quot;</td><td>&quot;中创物流&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:18:46</td><td>-5000.0</td><td>9.13</td><td>45650.0</td><td>45596.59</td><td>7.3</td><td>45.65</td><td>0.46</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2023-06-12</td><td>&quot;300641&quot;</td><td>&quot;正丹股份&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>13:22:32</td><td>-9600.0</td><td>5.05</td><td>48480.0</td><td>48423.76</td><td>7.76</td><td>48.48</td><td>0.48</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2023-06-02</td><td>&quot;000655&quot;</td><td>&quot;金岭矿业&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:26:35</td><td>-7500.0</td><td>6.48</td><td>48600.0</td><td>48543.61</td><td>7.78</td><td>48.61</td><td>0.47</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2023-06-01</td><td>&quot;300214&quot;</td><td>&quot;日科化学&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:45:35</td><td>-7400.0</td><td>6.8</td><td>50320.0</td><td>50261.63</td><td>8.05</td><td>50.32</td><td>0.51</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr><tr><td>2023-09-11</td><td>&quot;603577&quot;</td><td>&quot;汇金通&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>09:46:10</td><td>-5100.0</td><td>9.3024</td><td>47442.0</td><td>47410.89</td><td>6.9</td><td>23.72</td><td>0.49</td><td>0.0</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td><td>&quot;湘财&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (257, 17)\n",
       "┌────────────┬──────────┬──────────┬──────────┬───┬────────┬──────────┬────────┬──────┐\n",
       "│ 发生日期   ┆ 证券代码 ┆ 证券名称 ┆ 买卖标志 ┆ … ┆ 其他费 ┆ 备注     ┆ 币种   ┆ 券商 │\n",
       "│ ---        ┆ ---      ┆ ---      ┆ ---      ┆   ┆ ---    ┆ ---      ┆ ---    ┆ ---  │\n",
       "│ date       ┆ str      ┆ str      ┆ str      ┆   ┆ f64    ┆ str      ┆ str    ┆ str  │\n",
       "╞════════════╪══════════╪══════════╪══════════╪═══╪════════╪══════════╪════════╪══════╡\n",
       "│ 2022-07-18 ┆ 002462   ┆ 嘉事堂   ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2022-07-18 ┆ 600408   ┆ 安泰集团 ┆ 买入     ┆ … ┆ 0.0    ┆ 证券买入 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2022-07-18 ┆ 600648   ┆ 外高桥   ┆ 买入     ┆ … ┆ 0.0    ┆ 证券买入 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2022-07-18 ┆ 600269   ┆ 赣粤高速 ┆ 买入     ┆ … ┆ 0.0    ┆ 证券买入 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2022-07-18 ┆ 600015   ┆ 华夏银行 ┆ 买入     ┆ … ┆ 0.0    ┆ 证券买入 ┆ 人民币 ┆ 湘财 │\n",
       "│ …          ┆ …        ┆ …        ┆ …        ┆ … ┆ …      ┆ …        ┆ …      ┆ …    │\n",
       "│ 2023-06-19 ┆ 603967   ┆ 中创物流 ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2023-06-12 ┆ 300641   ┆ 正丹股份 ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2023-06-02 ┆ 000655   ┆ 金岭矿业 ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2023-06-01 ┆ 300214   ┆ 日科化学 ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "│ 2023-09-11 ┆ 603577   ┆ 汇金通   ┆ 卖出     ┆ … ┆ 0.0    ┆ 证券卖出 ┆ 人民币 ┆ 湘财 │\n",
       "└────────────┴──────────┴──────────┴──────────┴───┴────────┴──────────┴────────┴──────┘"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "431d66e4-6ba7-4c9f-a15c-a84231e2defb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (10, 14)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券代码</th><th>证券名称</th><th>成交日期</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>操作</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th></tr><tr><td>str</td><td>str</td><td>date</td><td>time</td><td>i64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>f64</td><td>i64</td><td>f64</td><td>i64</td><td>str</td></tr></thead><tbody><tr><td>&quot;300107&quot;</td><td>&quot;建新股份&quot;</td><td>2023-05-29</td><td>null</td><td>0</td><td>0.0</td><td>600.0</td><td>600.0</td><td>&quot;卖&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;建新股份,深圳现金红利&quot;</td></tr><tr><td>&quot;131810&quot;</td><td>&quot;Ｒ-001&quot;</td><td>2023-05-24</td><td>null</td><td>1500</td><td>100.005</td><td>150007.66</td><td>150007.66</td><td>&quot;买&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;Ｒ-001,拆出购回&quot;</td></tr><tr><td>&quot;799999&quot;</td><td>&quot;指定登记&quot;</td><td>2023-05-24</td><td>15:00:00</td><td>0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;指&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;指定登记指定交易&quot;</td></tr><tr><td>&quot;600626&quot;</td><td>&quot;申达股份&quot;</td><td>2023-05-24</td><td>10:06:14</td><td>14800</td><td>3.37</td><td>49876.0</td><td>-49881.48</td><td>&quot;买&quot;</td><td>4.99</td><td>0</td><td>0.49</td><td>0</td><td>&quot;申达股份证券买入&quot;</td></tr><tr><td>&quot;600178&quot;</td><td>&quot;东安动力&quot;</td><td>2023-05-24</td><td>09:59:17</td><td>16400</td><td>6.07</td><td>99548.0</td><td>-99558.97</td><td>&quot;买&quot;</td><td>9.95</td><td>0</td><td>1.02</td><td>0</td><td>&quot;东安动力证券买入&quot;</td></tr><tr><td>&quot;603002&quot;</td><td>&quot;宏昌电子&quot;</td><td>2023-05-24</td><td>09:54:48</td><td>9800</td><td>5.06</td><td>49588.0</td><td>-49593.46</td><td>&quot;买&quot;</td><td>4.96</td><td>0</td><td>0.5</td><td>0</td><td>&quot;宏昌电子证券买入&quot;</td></tr><tr><td>&quot;131810&quot;</td><td>&quot;Ｒ-001&quot;</td><td>2023-05-23</td><td>10:05:49</td><td>1500</td><td>1.865</td><td>150000.0</td><td>-150001.5</td><td>&quot;卖&quot;</td><td>1.5</td><td>0</td><td>0.0</td><td>0</td><td>&quot;到期日[20230524]，利息[7.66]，金额[1500…</td></tr><tr><td>&quot;300107&quot;</td><td>&quot;建新股份&quot;</td><td>2023-05-23</td><td>10:01:57</td><td>10000</td><td>5.0</td><td>50000.0</td><td>-50005.0</td><td>&quot;买&quot;</td><td>5.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;建新股份证券买入&quot;</td></tr><tr><td>&quot;002224&quot;</td><td>&quot;三 力 士&quot;</td><td>2023-05-23</td><td>09:58:07</td><td>10800</td><td>4.59</td><td>49572.0</td><td>-49576.96</td><td>&quot;买&quot;</td><td>4.96</td><td>0</td><td>0.0</td><td>0</td><td>&quot;三 力 士证券买入&quot;</td></tr><tr><td>&quot;799998&quot;</td><td>&quot;指定撤销&quot;</td><td>2023-05-22</td><td>15:00:00</td><td>0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;撤&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;指定撤销撤消指定&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (10, 14)\n",
       "┌──────────┬──────────┬────────────┬──────────┬───┬────────┬────────┬────────┬─────────────────────────────────┐\n",
       "│ 证券代码 ┆ 证券名称 ┆ 成交日期   ┆ 成交时间 ┆ … ┆ 印花税 ┆ 过户费 ┆ 其他费 ┆ 备注                            │\n",
       "│ ---      ┆ ---      ┆ ---        ┆ ---      ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---                             │\n",
       "│ str      ┆ str      ┆ date       ┆ time     ┆   ┆ i64    ┆ f64    ┆ i64    ┆ str                             │\n",
       "╞══════════╪══════════╪════════════╪══════════╪═══╪════════╪════════╪════════╪═════════════════════════════════╡\n",
       "│ 300107   ┆ 建新股份 ┆ 2023-05-29 ┆ null     ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 建新股份,深圳现金红利           │\n",
       "│ 131810   ┆ Ｒ-001   ┆ 2023-05-24 ┆ null     ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ Ｒ-001,拆出购回                 │\n",
       "│ 799999   ┆ 指定登记 ┆ 2023-05-24 ┆ 15:00:00 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 指定登记指定交易                │\n",
       "│ 600626   ┆ 申达股份 ┆ 2023-05-24 ┆ 10:06:14 ┆ … ┆ 0      ┆ 0.49   ┆ 0      ┆ 申达股份证券买入                │\n",
       "│ 600178   ┆ 东安动力 ┆ 2023-05-24 ┆ 09:59:17 ┆ … ┆ 0      ┆ 1.02   ┆ 0      ┆ 东安动力证券买入                │\n",
       "│ 603002   ┆ 宏昌电子 ┆ 2023-05-24 ┆ 09:54:48 ┆ … ┆ 0      ┆ 0.5    ┆ 0      ┆ 宏昌电子证券买入                │\n",
       "│ 131810   ┆ Ｒ-001   ┆ 2023-05-23 ┆ 10:05:49 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 到期日[20230524]，利息[7.66]，  │\n",
       "│          ┆          ┆            ┆          ┆   ┆        ┆        ┆        ┆ 金额[1500…                      │\n",
       "│ 300107   ┆ 建新股份 ┆ 2023-05-23 ┆ 10:01:57 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 建新股份证券买入                │\n",
       "│ 002224   ┆ 三 力 士 ┆ 2023-05-23 ┆ 09:58:07 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 三 力 士证券买入                │\n",
       "│ 799998   ┆ 指定撤销 ┆ 2023-05-22 ┆ 15:00:00 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 指定撤销撤消指定                │\n",
       "└──────────┴──────────┴────────────┴──────────┴───┴────────┴────────┴────────┴─────────────────────────────────┘"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=pl.read_excel(\n",
    "    \"stock_trades/202305-海通普通.xlsx\",\n",
    "    schema_overrides={\n",
    "        \"成交日期\":pl.String,\n",
    "        \"成交时间\":pl.String,\n",
    "        },\n",
    ")\n",
    "df.with_columns(\n",
    "    pl.col(\"成交日期\").str.to_date(\"%Y%m%d\"),\n",
    "    pl.col(\"成交时间\").replace({\"\":None}).str.to_time(\"%H:%M:%S\"),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "da1d6b4f-753c-4c19-a40a-417f44f9ccc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (8, 14)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券代码</th><th>证券名称</th><th>成交日期</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>操作</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th></tr><tr><td>str</td><td>str</td><td>date</td><td>time</td><td>i64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>f64</td><td>i64</td><td>f64</td><td>i64</td><td>str</td></tr></thead><tbody><tr><td>&quot;799999&quot;</td><td>&quot;指定登记&quot;</td><td>2023-05-24</td><td>15:00:00</td><td>0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;指&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;指定登记指定交易&quot;</td></tr><tr><td>&quot;600626&quot;</td><td>&quot;申达股份&quot;</td><td>2023-05-24</td><td>10:06:14</td><td>14800</td><td>3.37</td><td>49876.0</td><td>-49881.48</td><td>&quot;买&quot;</td><td>4.99</td><td>0</td><td>0.49</td><td>0</td><td>&quot;申达股份证券买入&quot;</td></tr><tr><td>&quot;600178&quot;</td><td>&quot;东安动力&quot;</td><td>2023-05-24</td><td>09:59:17</td><td>16400</td><td>6.07</td><td>99548.0</td><td>-99558.97</td><td>&quot;买&quot;</td><td>9.95</td><td>0</td><td>1.02</td><td>0</td><td>&quot;东安动力证券买入&quot;</td></tr><tr><td>&quot;603002&quot;</td><td>&quot;宏昌电子&quot;</td><td>2023-05-24</td><td>09:54:48</td><td>9800</td><td>5.06</td><td>49588.0</td><td>-49593.46</td><td>&quot;买&quot;</td><td>4.96</td><td>0</td><td>0.5</td><td>0</td><td>&quot;宏昌电子证券买入&quot;</td></tr><tr><td>&quot;131810&quot;</td><td>&quot;Ｒ-001&quot;</td><td>2023-05-23</td><td>10:05:49</td><td>1500</td><td>1.865</td><td>150000.0</td><td>-150001.5</td><td>&quot;卖&quot;</td><td>1.5</td><td>0</td><td>0.0</td><td>0</td><td>&quot;到期日[20230524]，利息[7.66]，金额[1500…</td></tr><tr><td>&quot;300107&quot;</td><td>&quot;建新股份&quot;</td><td>2023-05-23</td><td>10:01:57</td><td>10000</td><td>5.0</td><td>50000.0</td><td>-50005.0</td><td>&quot;买&quot;</td><td>5.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;建新股份证券买入&quot;</td></tr><tr><td>&quot;002224&quot;</td><td>&quot;三 力 士&quot;</td><td>2023-05-23</td><td>09:58:07</td><td>10800</td><td>4.59</td><td>49572.0</td><td>-49576.96</td><td>&quot;买&quot;</td><td>4.96</td><td>0</td><td>0.0</td><td>0</td><td>&quot;三 力 士证券买入&quot;</td></tr><tr><td>&quot;799998&quot;</td><td>&quot;指定撤销&quot;</td><td>2023-05-22</td><td>15:00:00</td><td>0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;撤&quot;</td><td>0.0</td><td>0</td><td>0.0</td><td>0</td><td>&quot;指定撤销撤消指定&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (8, 14)\n",
       "┌──────────┬──────────┬────────────┬──────────┬───┬────────┬────────┬────────┬─────────────────────────────────┐\n",
       "│ 证券代码 ┆ 证券名称 ┆ 成交日期   ┆ 成交时间 ┆ … ┆ 印花税 ┆ 过户费 ┆ 其他费 ┆ 备注                            │\n",
       "│ ---      ┆ ---      ┆ ---        ┆ ---      ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---                             │\n",
       "│ str      ┆ str      ┆ date       ┆ time     ┆   ┆ i64    ┆ f64    ┆ i64    ┆ str                             │\n",
       "╞══════════╪══════════╪════════════╪══════════╪═══╪════════╪════════╪════════╪═════════════════════════════════╡\n",
       "│ 799999   ┆ 指定登记 ┆ 2023-05-24 ┆ 15:00:00 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 指定登记指定交易                │\n",
       "│ 600626   ┆ 申达股份 ┆ 2023-05-24 ┆ 10:06:14 ┆ … ┆ 0      ┆ 0.49   ┆ 0      ┆ 申达股份证券买入                │\n",
       "│ 600178   ┆ 东安动力 ┆ 2023-05-24 ┆ 09:59:17 ┆ … ┆ 0      ┆ 1.02   ┆ 0      ┆ 东安动力证券买入                │\n",
       "│ 603002   ┆ 宏昌电子 ┆ 2023-05-24 ┆ 09:54:48 ┆ … ┆ 0      ┆ 0.5    ┆ 0      ┆ 宏昌电子证券买入                │\n",
       "│ 131810   ┆ Ｒ-001   ┆ 2023-05-23 ┆ 10:05:49 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 到期日[20230524]，利息[7.66]，  │\n",
       "│          ┆          ┆            ┆          ┆   ┆        ┆        ┆        ┆ 金额[1500…                      │\n",
       "│ 300107   ┆ 建新股份 ┆ 2023-05-23 ┆ 10:01:57 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 建新股份证券买入                │\n",
       "│ 002224   ┆ 三 力 士 ┆ 2023-05-23 ┆ 09:58:07 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 三 力 士证券买入                │\n",
       "│ 799998   ┆ 指定撤销 ┆ 2023-05-22 ┆ 15:00:00 ┆ … ┆ 0      ┆ 0.0    ┆ 0      ┆ 指定撤销撤消指定                │\n",
       "└──────────┴──────────┴────────────┴──────────┴───┴────────┴────────┴────────┴─────────────────────────────────┘"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=pl.read_excel(\n",
    "    \"stock_trades/202305-海通普通.xlsx\",\n",
    "    schema_overrides={\n",
    "        \"成交日期\":pl.String,\n",
    "        \"成交时间\":pl.String,\n",
    "        },\n",
    ")\n",
    "df.filter(pl.col(\"成交时间\")!=\"\").with_columns(\n",
    "    pl.col(\"成交日期\").str.to_date(\"%Y%m%d\"),\n",
    "    pl.col(\"成交时间\").str.to_time(),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "53a07141-7b31-47e1-9af6-237602223ffd",
   "metadata": {},
   "outputs": [],
   "source": [
    "def read_df_海通普通(f:str | Path)-> pl.DataFrame:\n",
    "    df=pl.read_excel(\n",
    "       f,\n",
    "        schema_overrides={\n",
    "            \"成交日期\":pl.String,\n",
    "            \"成交时间\":pl.String,\n",
    "            \"成交数量\":pl.Float64,\n",
    "             \"成交金额\":pl.Float64,\n",
    "             \"印花税\":pl.Float64,\n",
    "            \"其他费\":pl.Float64,\n",
    "        },\n",
    "    )\n",
    "    df=df.filter(\n",
    "           (pl.col(\"成交时间\")!=\"\")\n",
    "            & (pl.col(\"操作\").is_in([\"买\",\"卖\"]))\n",
    "            & (~pl.col(\"证券代码\").str.starts_with(\"204\"))\n",
    "            & (~pl.col(\"证券代码\").str.starts_with(\"1318\"))\n",
    "        ).with_columns(\n",
    "         pl.col(\"成交日期\").str.to_date(\"%Y%m%d\"),\n",
    "         pl.col(\"成交时间\").str.to_time(),\n",
    "    )   \n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "4d195579-1f1f-44f0-ab22-c1ea0c0f8b09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (53, 15)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券代码</th><th>证券名称</th><th>成交日期</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>操作</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>券商</th></tr><tr><td>str</td><td>str</td><td>date</td><td>time</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;600626&quot;</td><td>&quot;申达股份&quot;</td><td>2023-05-24</td><td>10:06:14</td><td>14800.0</td><td>3.37</td><td>49876.0</td><td>-49881.48</td><td>&quot;买&quot;</td><td>4.99</td><td>0.0</td><td>0.49</td><td>0.0</td><td>&quot;申达股份证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;600178&quot;</td><td>&quot;东安动力&quot;</td><td>2023-05-24</td><td>09:59:17</td><td>16400.0</td><td>6.07</td><td>99548.0</td><td>-99558.97</td><td>&quot;买&quot;</td><td>9.95</td><td>0.0</td><td>1.02</td><td>0.0</td><td>&quot;东安动力证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;603002&quot;</td><td>&quot;宏昌电子&quot;</td><td>2023-05-24</td><td>09:54:48</td><td>9800.0</td><td>5.06</td><td>49588.0</td><td>-49593.46</td><td>&quot;买&quot;</td><td>4.96</td><td>0.0</td><td>0.5</td><td>0.0</td><td>&quot;宏昌电子证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;300107&quot;</td><td>&quot;建新股份&quot;</td><td>2023-05-23</td><td>10:01:57</td><td>10000.0</td><td>5.0</td><td>50000.0</td><td>-50005.0</td><td>&quot;买&quot;</td><td>5.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;建新股份证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;002224&quot;</td><td>&quot;三 力 士&quot;</td><td>2023-05-23</td><td>09:58:07</td><td>10800.0</td><td>4.59</td><td>49572.0</td><td>-49576.96</td><td>&quot;买&quot;</td><td>4.96</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;三 力 士证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;605196&quot;</td><td>&quot;华通线缆&quot;</td><td>2023-07-17</td><td>10:03:09</td><td>7200.0</td><td>7.81</td><td>56232.0</td><td>56169.59</td><td>&quot;卖&quot;</td><td>5.62</td><td>56.23</td><td>0.56</td><td>0.0</td><td>&quot;华通线缆证券卖出&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;002842&quot;</td><td>&quot;翔鹭钨业&quot;</td><td>2023-07-11</td><td>10:04:39</td><td>5900.0</td><td>8.68</td><td>51212.0</td><td>51155.66</td><td>&quot;卖&quot;</td><td>5.12</td><td>51.22</td><td>0.0</td><td>0.0</td><td>&quot;翔鹭钨业证券卖出&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;002331&quot;</td><td>&quot;皖通科技&quot;</td><td>2023-07-11</td><td>10:03:52</td><td>6900.0</td><td>7.33</td><td>50577.0</td><td>50521.36</td><td>&quot;卖&quot;</td><td>5.06</td><td>50.58</td><td>0.0</td><td>0.0</td><td>&quot;皖通科技证券卖出&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;600300&quot;</td><td>&quot;维维股份&quot;</td><td>2023-07-11</td><td>10:13:04</td><td>16400.0</td><td>3.05</td><td>50020.0</td><td>-50025.5</td><td>&quot;买&quot;</td><td>5.0</td><td>0.0</td><td>0.5</td><td>0.0</td><td>&quot;维维股份证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr><tr><td>&quot;600287&quot;</td><td>&quot;江苏舜天&quot;</td><td>2023-07-11</td><td>10:08:50</td><td>9900.0</td><td>5.06</td><td>50094.0</td><td>-50099.51</td><td>&quot;买&quot;</td><td>5.01</td><td>0.0</td><td>0.5</td><td>0.0</td><td>&quot;江苏舜天证券买入&quot;</td><td>&quot;海通普通&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (53, 15)\n",
       "┌──────────┬──────────┬────────────┬──────────┬───┬────────┬────────┬──────────────────┬──────────┐\n",
       "│ 证券代码 ┆ 证券名称 ┆ 成交日期   ┆ 成交时间 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注             ┆ 券商     │\n",
       "│ ---      ┆ ---      ┆ ---        ┆ ---      ┆   ┆ ---    ┆ ---    ┆ ---              ┆ ---      │\n",
       "│ str      ┆ str      ┆ date       ┆ time     ┆   ┆ f64    ┆ f64    ┆ str              ┆ str      │\n",
       "╞══════════╪══════════╪════════════╪══════════╪═══╪════════╪════════╪══════════════════╪══════════╡\n",
       "│ 600626   ┆ 申达股份 ┆ 2023-05-24 ┆ 10:06:14 ┆ … ┆ 0.49   ┆ 0.0    ┆ 申达股份证券买入 ┆ 海通普通 │\n",
       "│ 600178   ┆ 东安动力 ┆ 2023-05-24 ┆ 09:59:17 ┆ … ┆ 1.02   ┆ 0.0    ┆ 东安动力证券买入 ┆ 海通普通 │\n",
       "│ 603002   ┆ 宏昌电子 ┆ 2023-05-24 ┆ 09:54:48 ┆ … ┆ 0.5    ┆ 0.0    ┆ 宏昌电子证券买入 ┆ 海通普通 │\n",
       "│ 300107   ┆ 建新股份 ┆ 2023-05-23 ┆ 10:01:57 ┆ … ┆ 0.0    ┆ 0.0    ┆ 建新股份证券买入 ┆ 海通普通 │\n",
       "│ 002224   ┆ 三 力 士 ┆ 2023-05-23 ┆ 09:58:07 ┆ … ┆ 0.0    ┆ 0.0    ┆ 三 力 士证券买入 ┆ 海通普通 │\n",
       "│ …        ┆ …        ┆ …          ┆ …        ┆ … ┆ …      ┆ …      ┆ …                ┆ …        │\n",
       "│ 605196   ┆ 华通线缆 ┆ 2023-07-17 ┆ 10:03:09 ┆ … ┆ 0.56   ┆ 0.0    ┆ 华通线缆证券卖出 ┆ 海通普通 │\n",
       "│ 002842   ┆ 翔鹭钨业 ┆ 2023-07-11 ┆ 10:04:39 ┆ … ┆ 0.0    ┆ 0.0    ┆ 翔鹭钨业证券卖出 ┆ 海通普通 │\n",
       "│ 002331   ┆ 皖通科技 ┆ 2023-07-11 ┆ 10:03:52 ┆ … ┆ 0.0    ┆ 0.0    ┆ 皖通科技证券卖出 ┆ 海通普通 │\n",
       "│ 600300   ┆ 维维股份 ┆ 2023-07-11 ┆ 10:13:04 ┆ … ┆ 0.5    ┆ 0.0    ┆ 维维股份证券买入 ┆ 海通普通 │\n",
       "│ 600287   ┆ 江苏舜天 ┆ 2023-07-11 ┆ 10:08:50 ┆ … ┆ 0.5    ┆ 0.0    ┆ 江苏舜天证券买入 ┆ 海通普通 │\n",
       "└──────────┴──────────┴────────────┴──────────┴───┴────────┴────────┴──────────────────┴──────────┘"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = [read_df_海通普通(p) for p in Path(\"stock_trades/\").glob(\"*-海通普通.xlsx\")]\n",
    "df=pl.concat(df)\n",
    "d2=df.with_columns(券商=pl.lit(\"海通普通\"),)\n",
    "d2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "04875745-0660-4647-9593-e77d29a67ce5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[WindowsPath('stock_trades/202305-海通普通.xlsx'),\n",
       " WindowsPath('stock_trades/202306-海通普通.xlsx'),\n",
       " WindowsPath('stock_trades/202307-海通普通.xlsx')]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(Path(\"stock_trades/\").glob(\"*-海通普通.xlsx\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "5fe82a4f-a941-4d8e-804c-63131186d849",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = [read_df_海通普通(p) for p in Path(\"stock_trades/\").glob(\"*-海通两融.xlsx\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "968e25b1-0923-4cc3-ab2a-155b27d0dd89",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (53, 15)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券代码</th><th>证券名称</th><th>成交日期</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>操作</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>券商</th></tr><tr><td>str</td><td>str</td><td>date</td><td>time</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;600638&quot;</td><td>&quot;新黄浦&quot;</td><td>2023-07-26</td><td>09:33:56</td><td>9300.0</td><td>6.526</td><td>60696.0</td><td>60628.01</td><td>&quot;卖&quot;</td><td>6.68</td><td>60.7</td><td>0.61</td><td>0.0</td><td>&quot;新黄浦证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;002492&quot;</td><td>&quot;恒基达鑫&quot;</td><td>2023-07-27</td><td>09:30:42</td><td>8700.0</td><td>6.12</td><td>53244.0</td><td>53184.91</td><td>&quot;卖&quot;</td><td>5.86</td><td>53.23</td><td>0.0</td><td>0.0</td><td>&quot;恒基达鑫证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;002136&quot;</td><td>&quot;安 纳 达&quot;</td><td>2023-07-27</td><td>09:32:52</td><td>4400.0</td><td>11.881</td><td>52277.0</td><td>52218.97</td><td>&quot;卖&quot;</td><td>5.75</td><td>52.28</td><td>0.0</td><td>0.0</td><td>&quot;安 纳 达证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;603967&quot;</td><td>&quot;中创物流&quot;</td><td>2023-08-22</td><td>09:36:13</td><td>10600.0</td><td>9.36</td><td>99216.0</td><td>99104.85</td><td>&quot;卖&quot;</td><td>10.91</td><td>99.24</td><td>1.0</td><td>0.0</td><td>&quot;中创物流证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;603967&quot;</td><td>&quot;中创物流&quot;</td><td>2023-08-04</td><td>10:07:37</td><td>10600.0</td><td>9.43</td><td>99958.0</td><td>-99970.01</td><td>&quot;买&quot;</td><td>11.0</td><td>0.0</td><td>1.01</td><td>0.0</td><td>&quot;中创物流证券买入&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;300464&quot;</td><td>&quot;星徽股份&quot;</td><td>2023-10-18</td><td>09:46:15</td><td>16100.0</td><td>5.74</td><td>92414.0</td><td>92358.97</td><td>&quot;卖&quot;</td><td>8.82</td><td>46.21</td><td>0.0</td><td>0.0</td><td>&quot;星徽股份证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;002661&quot;</td><td>&quot;克明食品&quot;</td><td>2023-10-18</td><td>09:55:41</td><td>8500.0</td><td>9.42</td><td>80072.0</td><td>-80079.64</td><td>&quot;买&quot;</td><td>7.64</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;克明食品证券买入&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;002753&quot;</td><td>&quot;永东股份&quot;</td><td>2023-10-09</td><td>09:48:02</td><td>14200.0</td><td>7.02</td><td>99684.0</td><td>-99693.51</td><td>&quot;买&quot;</td><td>9.51</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;永东股份证券买入&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;000698&quot;</td><td>&quot;沈阳化工&quot;</td><td>2023-10-09</td><td>09:45:18</td><td>23800.0</td><td>4.053</td><td>96460.0</td><td>96402.56</td><td>&quot;卖&quot;</td><td>9.2</td><td>48.24</td><td>0.0</td><td>0.0</td><td>&quot;沈阳化工证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr><tr><td>&quot;605288&quot;</td><td>&quot;凯迪股份&quot;</td><td>2023-10-09</td><td>09:44:40</td><td>2500.0</td><td>40.838</td><td>102094.0</td><td>102032.21</td><td>&quot;卖&quot;</td><td>9.74</td><td>51.05</td><td>1.0</td><td>0.0</td><td>&quot;凯迪股份证券卖出&quot;</td><td>&quot;海通两融&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (53, 15)\n",
       "┌──────────┬──────────┬────────────┬──────────┬───┬────────┬────────┬──────────────────┬──────────┐\n",
       "│ 证券代码 ┆ 证券名称 ┆ 成交日期   ┆ 成交时间 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注             ┆ 券商     │\n",
       "│ ---      ┆ ---      ┆ ---        ┆ ---      ┆   ┆ ---    ┆ ---    ┆ ---              ┆ ---      │\n",
       "│ str      ┆ str      ┆ date       ┆ time     ┆   ┆ f64    ┆ f64    ┆ str              ┆ str      │\n",
       "╞══════════╪══════════╪════════════╪══════════╪═══╪════════╪════════╪══════════════════╪══════════╡\n",
       "│ 600638   ┆ 新黄浦   ┆ 2023-07-26 ┆ 09:33:56 ┆ … ┆ 0.61   ┆ 0.0    ┆ 新黄浦证券卖出   ┆ 海通两融 │\n",
       "│ 002492   ┆ 恒基达鑫 ┆ 2023-07-27 ┆ 09:30:42 ┆ … ┆ 0.0    ┆ 0.0    ┆ 恒基达鑫证券卖出 ┆ 海通两融 │\n",
       "│ 002136   ┆ 安 纳 达 ┆ 2023-07-27 ┆ 09:32:52 ┆ … ┆ 0.0    ┆ 0.0    ┆ 安 纳 达证券卖出 ┆ 海通两融 │\n",
       "│ 603967   ┆ 中创物流 ┆ 2023-08-22 ┆ 09:36:13 ┆ … ┆ 1.0    ┆ 0.0    ┆ 中创物流证券卖出 ┆ 海通两融 │\n",
       "│ 603967   ┆ 中创物流 ┆ 2023-08-04 ┆ 10:07:37 ┆ … ┆ 1.01   ┆ 0.0    ┆ 中创物流证券买入 ┆ 海通两融 │\n",
       "│ …        ┆ …        ┆ …          ┆ …        ┆ … ┆ …      ┆ …      ┆ …                ┆ …        │\n",
       "│ 300464   ┆ 星徽股份 ┆ 2023-10-18 ┆ 09:46:15 ┆ … ┆ 0.0    ┆ 0.0    ┆ 星徽股份证券卖出 ┆ 海通两融 │\n",
       "│ 002661   ┆ 克明食品 ┆ 2023-10-18 ┆ 09:55:41 ┆ … ┆ 0.0    ┆ 0.0    ┆ 克明食品证券买入 ┆ 海通两融 │\n",
       "│ 002753   ┆ 永东股份 ┆ 2023-10-09 ┆ 09:48:02 ┆ … ┆ 0.0    ┆ 0.0    ┆ 永东股份证券买入 ┆ 海通两融 │\n",
       "│ 000698   ┆ 沈阳化工 ┆ 2023-10-09 ┆ 09:45:18 ┆ … ┆ 0.0    ┆ 0.0    ┆ 沈阳化工证券卖出 ┆ 海通两融 │\n",
       "│ 605288   ┆ 凯迪股份 ┆ 2023-10-09 ┆ 09:44:40 ┆ … ┆ 1.0    ┆ 0.0    ┆ 凯迪股份证券卖出 ┆ 海通两融 │\n",
       "└──────────┴──────────┴────────────┴──────────┴───┴────────┴────────┴──────────────────┴──────────┘"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = [read_df_海通普通(p) for p in Path(\"stock_trades/\").glob(\"*-海通两融.xlsx\")]\n",
    "df=pl.concat(df)\n",
    "d3=df.with_columns(券商=pl.lit(\"海通两融\"),)\n",
    "d3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "cc0a67be-98db-4167-a0d0-bb4b602de7ac",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=d1.select(\n",
    "     券商=pl.col(\"券商\"),\n",
    "     交易日期=pl.col(\"发生日期\"),\n",
    "     交易时间=pl.col(\"成交时间\"),\n",
    "     证券代码=pl.col(\"证券代码\"),\n",
    "     证券名称=pl.col(\"证券名称\"),\n",
    "     买卖标志=pl.col(\"业务名称\").replace({\"证券卖出\":\"卖出\",\"证券买入\":\"买入\"}),\n",
    "     成交价格=pl.col(\"成交价格\"),  \n",
    "     成交数量=pl.col(\"成交数量\").abs(),\n",
    "     成交金额=pl.col(\"成交金额\"), \n",
    "     手续费=pl.col(\"手续费\"), \n",
    "     印花税=pl.col(\"印花税\"),\n",
    "     过户费=pl.col(\"过户费\"), \n",
    "     其他费=pl.col(\"其他费\"), \n",
    "     发生金额=pl.col(\"发生金额\"), \n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "81c32800-242d-42c5-9c7a-714d394ec049",
   "metadata": {},
   "outputs": [],
   "source": [
    "d2=d2.select(\n",
    "     券商=pl.col(\"券商\"),\n",
    "     交易日期=pl.col(\"成交日期\"),\n",
    "     交易时间=pl.col(\"成交时间\"),\n",
    "     证券代码=pl.col(\"证券代码\"),\n",
    "     证券名称=pl.col(\"证券名称\"),\n",
    "     买卖标志=pl.col(\"操作\").replace({\"卖\":\"卖出\",\"买\":\"买入\"}),\n",
    "     成交价格=pl.col(\"成交价格\"),  \n",
    "    成交数量=pl.col(\"成交数量\").abs(),\n",
    "    成交金额=pl.col(\"成交金额\"), \n",
    "    手续费=pl.col(\"手续费\"), \n",
    "    印花税=pl.col(\"印花税\"),\n",
    "    过户费=pl.col(\"过户费\"), \n",
    "    其他费=pl.col(\"其他费\"), \n",
    "    发生金额=pl.col(\"发生金额\"), \n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "ffbdbedf-0b42-478e-be42-7294c0767796",
   "metadata": {},
   "outputs": [],
   "source": [
    "d3=d3.select(\n",
    "     券商=pl.col(\"券商\"),\n",
    "     交易日期=pl.col(\"成交日期\"),\n",
    "     交易时间=pl.col(\"成交时间\"),\n",
    "     证券代码=pl.col(\"证券代码\"),\n",
    "     证券名称=pl.col(\"证券名称\"),\n",
    "     买卖标志=pl.col(\"操作\").replace({\"卖\":\"卖出\",\"买\":\"买入\"}),\n",
    "     成交价格=pl.col(\"成交价格\"),  \n",
    "    成交数量=pl.col(\"成交数量\").abs(),\n",
    "    成交金额=pl.col(\"成交金额\"), \n",
    "    手续费=pl.col(\"手续费\"),\n",
    "    印花税=pl.col(\"印花税\"),\n",
    "    过户费=pl.col(\"过户费\"), \n",
    "    其他费=pl.col(\"其他费\"), \n",
    "    发生金额=pl.col(\"发生金额\"), \n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "3ff5b533-b5de-4572-81df-e0bbd00630e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pl.concat([d1, d2, d3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "21b172a3-86be-43ef-b632-88ad80ffefac",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.write_csv(\"stock_trades.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "d9743572-dc48-4015-bc08-b3c487e839b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<xlsxwriter.workbook.Workbook at 0x17b1fb2e510>"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.write_excel(\"stock_trades.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "94fc70d8-a864-47bf-9f6f-bd11b3220b78",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.write_parquet(\"stock_trades.parquet\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "538789e1-ee0b-4c46-a084-90b1ea10d3e5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
